<template>
  <el-form ref="form" class="form" label-width="80px">
    <p>
      账&nbsp;&nbsp;&nbsp;号
      <el-input v-model="usertxt" placeholder="请输入账号"></el-input>
    </p>
    <p>
      新密码
      <el-input placeholder="请输入密码" v-model="psd" show-password></el-input>
    </p>
    <p>
      新密码
      <el-input
        placeholder="请再次输入密码"
        v-model="confirmPsd"
        show-password
      ></el-input>
    </p>
    <el-button type="primary" @click="chgEvt">提交</el-button>
  </el-form>
</template>

<script>
import { chgPassword } from "../../api/login";

export default {
  data() {
    return {
      usertxt: "",
      psd: "",
      confirmPsd: "",
    };
  },
  methods: {
    chgEvt() {
      chgPassword(this.usertxt,this.psd).then(res=>{
        if(res.ok === 1){
          alert(res.msg)
          this.$router.push('/userlogin/login')
        }
      })

    },
  },
};
</script>

<style lang='scss' scoped>
.form {
  height: 300px;
  width: 420px;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  margin: auto;
  text-align: center;
}

.el-input {
  width: 80%;
  margin-top: 14px;
}
.el-button {
  margin-top: 10px;
}
</style>
